<?php
require "../controller/ctrl-bin.php";
?>

<!DOCTYPEhtml>
<html>
	<head>
	<title>
			Candy Shop
		</title>
		<link href="../style/style.css" rel="stylesheet" type="text/css" />
		<meta http-equiv="content-type" content="text/html"; charset="utf-8">
	</head>
	<body>
		<div  id="container">

<!-- 

Left menu side   

-->		
			<div class="left">
				<div class="nav">
					<a href="../index.php">Категории</a>
					<ul>
						<a href="index.php?offset=<?php echo $get_off ?>&cat=1";>
							<li>Книги</li>
						</a>
						<a href="index.php?offset=<?php echo $get_off ?>&cat=2">
							<li>Переодика</li>
						</a>
						<a href="index.php?offset=<?php echo $get_off ?>&cat=3">
							<li>Фото</li>
						</a>
					</ul>
					<p>Корзина (<?php echo $quant; ?>)</p>
				</div>
			</div>

<!-- Middle - content part -->

			<div class="mid">
			<div class="head">
				<div class="order">
				<button type="button" id="ord-grp" class="btn btn-success" onclick="location.href='./form.php?ord=1'">Заказать </button>
				<button type="button" id="ord-grp" class="btn btn-warning" onclick="location.href='?clear=1&offset=0&cat=bin'">Очистить</button>
				</div>
				<div class="filters">
					<form action="bin.php" name="filter-form" method="POST">
						<select name="sort" onchange="this.form.submit();">
							<?php echo $i; ?>
						</select>
					</form>
				</div>	
			</div>
				<div class="products">
					<?php if ($data !== NULL){
					foreach ($data as $ent){ ?>
						<div class ="bprod">
							<div class="bin_align item">
							<a href="?cat=<?php echo $cat; ?>&id=<?php echo $ent['id']; ?>&offset=<?php echo $get_off; ?>&sort=<?php echo $sort ?>"> 
								<img src="../img/product/<?php echo $ent['img']; ?>" width="72" height="101"/>
							</a>
							<a class="title" href="?cat=<?php echo $cat; ?>&id=<?php echo $ent['id']; ?>&offset=<?php echo $get_off; ?>&sort=<?php echo $sort ?>">
								<?php echo $ent['title']; ?>
							</a>
						</div>
						<div style="padding-top:20px;">
								<span><b><?= $ent['title']; ?></b></span>
								<span style="text-align:right;"><?= $ent['issue_date']; ?></span>
							</div>
						<p><?php echo substr($ent['short_descr'], 0, 650);?></p>
					</div>	
					<?php ;} } ?>
				</div>	
			</div>

<!-- Right Description Side  -->

			<div class="right">
				<?php if (isset($get_id)){ ?>
					<div class="product-info">
						<?php if (isset($get_id)){ ?>
						<img src="../img/product/<?php echo $all['img']; ?>" width="72" height="101"/>
						<div class="info">
							<p><b>Название: </b><br/><?php echo $all['title']; ?></p>
							<p><b>ISBN: </b><br/><?php echo $all['isbn-sn']; ?></p>
							<p><b>Автор: </b><br/><?php echo $all['author']; ?></p>
							<p><b>Издательство: </b><br/><?php echo $all['publisher']; ?></p>
							<p><b>Краткое описание: </b><br/><?php echo $all['short_descr']; ?></p>
							<p><b>Содержание: </b><br/><?php echo $all['content']; ?></p>
							<p><b>Дата выпуска: </b><br/><?php echo $all['issue_date']; ?></p>
							<p><b>Цена: </b><br/><?php echo $all['price']; ?></p>
							<a href="?cat=<?php echo $cat; ?>&offset=<?php echo $get_off; ?>&excid=<?php echo $all['id']; ?>">
								<img src="../img/bin/shop-cart-exclude48.png" width="48" height="48" />
							</a>
						</div>
						<?php } ?>
					</div>
				<?php } ?>

<!-- Footer Side  -->

	<div class="footer">
					
			</div>
		</div>	
	</body>
</html>